home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <exec/ports.h>
- #include <exec/memory.h>
- #ifdef __GNUC__
- #define BASE_EXT_DECL
- #define BASE_NAME (*(void **)4)
- #include <inline/exec.h>
- #endif
-
- struct MsgPort *
- CreatePort(name, pri)
- char *name;
- LONG pri;
- {
- int sigBit;
- struct MsgPort *port;
-
- if ((sigBit = AllocSignal(-1)) == -1) return NULL;
-
- port = (struct MsgPort *)AllocMem(sizeof(struct MsgPort), MEMF_CLEAR|MEMF_PUBLIC);
- if (! port)
- {
- FreeSignal(sigBit);
- return NULL;
- }
-
- port->mp_Node.ln_Name = name;
- port->mp_Node.ln_Pri = pri;
- port->mp_Node.ln_Type = NT_MSGPORT;
-
- port->mp_Flags = PA_SIGNAL;
- port->mp_SigBit = sigBit;
- port->mp_SigTask = FindTask(0);
-
- if (name)
- AddPort(port);
- else
- NewList(&(port->mp_MsgList));
-
- return port;
- }
-